A. Field of the Invention
The present invention relates generally to a graphics system for a personal computer. More particularly, the present invention relates to a system for providing texture to images on a computer screen. Still more particularly, the present invention relates to an improved texturing technique that uses a selectable mode texture filter for applying a texture map to pixels on a screen.
B. Background of the Invention
Before the availability of the personal computer (commonly referred to as a PC), computer graphics packages were expensive tools primarily reserved for industrial applications. Early microcomputers were only capable of rendering simple line drawings with a low screen resolution (256 pixels.times.256 pixels, for example). As microcomputers evolved, higher resolution color displays became available, and software applications routinely provided data output in a graphical format. The graphics techniques used were unstructured, with objects defined in terms of absolute coordinates using straight lines. Subsequently, graphics "primitives" were developed, enabling circles, ellipses, rectangles and polygons to be drawn with single software instructions. The use of primitives for drawing shapes increased the speed at which the images could be rendered.
The availability of computer graphics has generated a demand for higher resolutions and three dimensional (3-D) rendering capabilities. Computer animation and games, in particular, have spawned a revolution in computer graphics capabilities. A 3-D image can be represented in a computer system as a collection of graphical objects, such as polygons, lines, and points. A set of vertex points defines a polygon. Associated with each point are certain parameters, such as shading, texturing, color, and the like. Identification of other non-vertex points within the polygon typically is done through the use of linear interpolation. Once interpolated, the polygon can be rendered on a computer monitor by scanning of successive rows of the polygon. By drawing multiple polygons on the screen at a time, an object can be drawn.
Further advancements in the computer graphics arena have led to techniques for enhancing the realistic appearance of objects drawn on the screen. Texture mapping, one of the significant aspects of 3-D graphics permits images on a computer screen to be displayed with texture. Thus, for example, a table top can be textured to have the appearance of a wood-grain or marble surface, or any other desired surface. In computer graphics, a texture map is an array of pixels that represents a particular pattern, such as a single brick. By repeatedly applying the texture map of a brick to side of a building, for example, the side will appear as a brick wall. The amount of memory required to represent the brick wall is minimal because only enough memory is required to store a texture map for a single brick. A pixel in a texture map is called a "texel." A texture map typically is constructed from a two-dimensional array of texels (typically represented with digital values). A u, v address or coordinate associated with each texel value in the texture map. Pixels on the computer screen, however, are assigned x, y addresses to represent the spatial location of the pixel on the computer screen. Thus, a pixel with an address of (10, 14) would be in the tenth column of pixels, fourteen rows down on the computer screen. Because texel values are not assigned an x, y value when applying a texture map to a polygon on the screen, a conversion from an x, y pixel address to a u, v texture map address is necessary. The conversion process is termed "mapping." A texel mapping algorithm thus uses an x, y pixel address to look up a corresponding texel in a texture map. The texel is then used to render the pixel at the x, y screen address.
Ordinarily, an x, y pixel address converts to a fractional u, v texture map coordinate. A "10.16" format is typically used to represent the converted u and v coordinates in which 10 bits are used for the integer portion of the coordinate along with 16 fractional bits. The coordinates of texel values in a texel map, however, include only integer values, and thus the converted u, v coordinate usually will not correspond exactly to a texel in the texel map. Point sampling provides the simplest method for selecting a texel from a texel map for applying to objects. In point sampling, the texel from the texture map closest to the fractional u, v coordinate is selected to render the corresponding x, y pixel on the screen. For example and referring to FIG. 1, four texels A, B, C, and D from a texture map are shown with their integer u, v coordinates. An address in x, y space might convert to u, v texture space as point P1 with u, v coordinates (1.25, 1.30). Of the four closest texels A, B, C, and D, point P1 is closest texel A. Using the point sampling technique, texel A would be selected to be mapped onto the x, y pixel associated with point P1. With point sampling, only one texel is used for each pixel during mapping and thus only one memory access is required to fetch the selected nearest texel. Although simple and fast, images rendered with point sampling may appear blocky and "scintillate," or sparkle, when the object moves detracting from the appearance of the object.
In certain instances, however, point sampled images are acceptable. For example, rendered with perspective, a brick wall may appear to recede into the distance. The appearance of the foreground part of the wall would suffer if point sampling was used. However, the problems associated with point sampled images would be imperceptible if point sampling was used to texture the distant part of the wall because of the diminished resolution associated with objects drawn to appear distant.
Filtering techniques such as bilinear averaging result generally in higher quality texture images. Bilinear averaging combines the four nearest texels in a weighted average to derive a single texel value used to render the pixel. Referring again to FIG. 1, in the u axis point P1 is generally closer to texel A than texel B and closer to texel C than texel D. Thus, the bilinear weighted average of texels A, B, C, and D generally weights A more than B, and C more than D. In the v axis, the result is similar with texels A and B weighted more heavily than texels C and D because point P1 is closer to texels A and B than C and D. Bilinear averaged images achieve superior quality than point sampled images, but require more computer and processing power. Because four texels are averaged together, four accesses to texture memory are required to fetch the four texels, taking considerably more time than the single memory access required by point sampling. Further, the averaging process, including calculation of the weights associated with each texel to be averaged, requires time to perform.
Graphics systems that employ texturing typically use only one texture mapping technique at a time when rendering images. Thus, one graphics system might use point sampling for faster speed, while other systems might use bilinear averaging for higher quality. Both types of systems, however, suffer from the problems attendant to each texturing technique.
There is a need for an improved graphics system that provides the high quality texture mapped images of bilinear averaging and other filtering methods, at speeds comparable to point sampling techniques. Such a system would permit high quality graphics at speeds faster than permitted by standard filtering techniques. Despite the advantages such a system would offer, to date no such system has been developed.